# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=restinio
pkgver=0.6.19
pkgrel=0
pkgdesc="Header-only C++14 library that gives you an embedded HTTP/Websocket server"
url="https://stiffstream.com/en/products/restinio.html"
arch="noarch"
license=" BSD-3-Clause"
makedepends="cmake openssl-dev zlib-dev pcre2-dev boost-dev fmt-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/Stiffstream/restinio/releases/download/v.$pkgver/restinio-$pkgver.tar.bz2
	lfs64.patch
	"
options="!check" # cant get checks to work

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja -S dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DRESTINIO_FIND_DEPS=ON \
		-DRESTINIO_TEST=OFF \
		-DRESTINIO_SAMPLE=OFF \
		-DRESTINIO_INSTALL_SAMPLES=OFF \
		-DRESTINIO_BENCH=OFF \
		-DRESTINIO_INSTALL_BENCHES=OFF \
		-DRESTINIO_ALLOW_SOBJECTIZER=OFF \
		-DRESTINIO_USE_EXTERNAL_HTTP_PARSER=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	  DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9b0309b33fb7beb4d7c5b541f5c7eda734f4eb5615cb2114e7f5609b757b94a3e8f22f82d865bbe6530d1443db81289b94c436fb69c808d6d456ce24205a3249  restinio-0.6.19.tar.bz2
a26b26275c76d720d2502b20d431e7990b42c7f3cae94b4a17521718ee9c9abf0b625e19286d12c53f61a058fd83129428e8a90a0f6c8ab8ad5a142b7ae4fb47  lfs64.patch
"
